//Wed Apr 20 16:28:55 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class ToastXToast {
public:
	int bake(vector<int> undertoasted, vector<int> overtoasted) {
		sort(undertoasted.begin(), undertoasted.end());
		sort(overtoasted.begin(), overtoasted.end());
		if (overtoasted[0] <= undertoasted[0] || overtoasted.back()
				<= undertoasted.back())
			return -1;
		if (overtoasted.front() > undertoasted.back())
			return 1;
		return 2;
	}
};

